/** 将form表单转换成js Object **/
$.fn.serializeObject = function() {
	var o = {};
	var a = this.serializeArray();
	$.each(a, function() {
		if (o[this.name] !== undefined) {
			if (!o[this.name].push) {
				o[this.name] = [o[this.name]];
			}
			o[this.name].push(this.value || '');
		} else {
			o[this.name] = this.value || '';
		}
	});
	return o;
};

// easyui判断两输入框值是否相同
$.extend($.fn.validatebox.defaults.rules, {
    equals: {
		validator: function(value,param){
			return value == $(param[0]).val();
		},
		message: '{1}'
    }
});

//function getFullScreen(id){
//	var fullScreenHeight;
//	
//	var windowHeight = $(window).height();
//	var bodyMarginTop = parseInt($("body").css("margin-top"));
//	var bodyMarginBottom = parseInt($("body").css("margin-bottom"));
//	
//	fullScreenHeight = windowHeight - bodyMarginTop - bodyMarginBottom;
//	
//	var $children = $("body").children();
//	
//	for(var i=0,len=$children.length; i<len; i++){
//		var $child = $children.eq(i);
//		
//		if(!$child.is(":hidden") && $child.attr("id")!=id && $child.find("#"+id).length==0){
//			fullScreenHeight = fullScreenHeight - $child.outerHeight();
//			fullScreenHeight = fullScreenHeight - parseInt($child.css("margin-top"));
//			fullScreenHeight = fullScreenHeight - parseInt($child.css("margin-bottom"));
//		}
//	}
//	
//	return fullScreenHeight;
//}

function getFullScreen(id){
	var fullScreenHeight;
	
	var windowHeight = $(window).height();
	
	var $target = $("body");
	
	var $easyuiGird = $('#'+id).parent().parent().parent();
	
	fullScreenHeight = getDomfullScreenHeight(windowHeight, $target, $easyuiGird, id);
	
	return fullScreenHeight;
}

function getDomfullScreenHeight(fullScreenHeight, $jObj, $ignoreObj, ignoreId){
	if($jObj[0] == $ignoreObj[0]){
		return fullScreenHeight;
	}
	
	var $target;
	
	var selfMarginTop = parseInt($jObj.css("margin-top"));
	var selfMarginBottom = parseInt($jObj.css("margin-bottom"));
	var selfPaddingTop = parseInt($jObj.css("padding-top"));
	var selfPaddingBottom = parseInt($jObj.css("padding-bottom"));
	
	fullScreenHeight = fullScreenHeight - selfMarginTop - selfMarginBottom - selfPaddingTop - selfPaddingBottom;
	
	var $children = $jObj.children();
	
	for(var i=0,len=$children.length; i<len; i++){
		var $child = $children.eq(i);
		
		if(!$child.is(":hidden") && $child.attr("id")!=ignoreId && $child.find("#"+ignoreId).length==0
				&& !$child.is(".layout-panel-west") && !$child.is(".layout-panel-east") && !$child.is(".layout-panel-center")){
			fullScreenHeight = fullScreenHeight - $child.outerHeight();
			fullScreenHeight = fullScreenHeight - parseInt($child.css("margin-top"));
			fullScreenHeight = fullScreenHeight - parseInt($child.css("margin-bottom"));
		}
		
		if($child.find("#"+ignoreId).length > 0){
			$target = $child;
		}
	}
	
	return getDomfullScreenHeight(fullScreenHeight, $target, $ignoreObj, ignoreId);
}